package aod.android.com.bernay.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.TextView;

import aod.android.com.bernay.R;

public class DateTimeView extends LinearLayout {

    private HorizontalScrollView mHorizontalScrollView;

    private LinearLayout mLinearLayout;

    public DateTimeView(Context context) {
        super(context);
        init();
    }

    public DateTimeView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public DateTimeView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }


    public void init(){
        View v = LayoutInflater.from(getContext()).inflate(R.layout.datatimeview,null);
        mHorizontalScrollView = v.findViewById(R.id.hscroview);
        mLinearLayout = v.findViewById(R.id.views);
        addView(v);
    }


    public void getTest(){
        addView("");
        addView("");

        for(int i = 0 ; i < 24 ; i++){
            addView((i<10?"0"+i:i)+":00");
        }
        addView("");
        addView("");
    }


    public void addView(String date){
        View v = LayoutInflater.from(getContext()).inflate(R.layout.date_time,null);
        TextView t = v.findViewById(R.id.date_tv);

        t.setText(date);
        mLinearLayout.addView(v);
    }
}
